import { reactive, ref, Ref } from "vue";
import { useRouter } from "vue-router";

// 定义接口
interface userInfo {
  name: string;
  age: number;
}

export default class TablePage {
  public count: Ref<number>;
  public isOpen: Ref<boolean>;
  public userInfo: userInfo;
  public baseData: any;
  public router: any;
  public propsObj: any;
  public isShowDial: Ref<boolean>;

  constructor() {
    this.isShowDial = ref(false);
    this.count = ref(0);
    this.isOpen = ref(false);
    this.userInfo = { name: "zhangsan", age: 16 };
    this.baseData = reactive({
      propsObj: {
        label: "label",
        value: "value",
        children: "children",
        checkStrictly: true,
        expandTrigger: "hover" as const,
      },
      rules: {
        logicDelete: [
          { required: true, message: "逻辑删除不能为空", trigger: "blur" },
        ],
      },
      open: false,
      loading: true,
      showSearch: true,
      ids: [] as any[],
      single: true,
      multiple: true,
      total: 0,
      title: "",
      background: true,
      small: true,
      form: {} as any,
      applyId: null,
      id: null,
      applyList: [] as any,
      tableConditions: {} as any,
      tableData: ref([]),
      dialogTitleApply: null,
      dialoApplyList: ref([
        { applyName: "申请单位名称", value: "" },
        { applyName: "负责人", value: "" },
        { applyName: "负责人联系电话", value: "" },
        { applyName: "申请事由", value: "" },
        { applyName: "申请内容", value: "" },
        { applyName: "会签规划", value: "" },
        { applyName: "现场勘查", value: "" },
        { applyName: "生产审批", value: "" },
        { applyName: "申请单位类别", value: "" },
        { applyName: "工程名称", value: "" },
      ]),
      addList: ref([
        {
          name: "内部单位", //默认内部单位
          id: "typeApply",
          applyName: "申请单位类别",
          value: "",
          info: "",
        },
        {
          name: null,
          id: "nameApply",
          applyName: "申请单位名称",
          value: "",
          info: "请输入申请单位名称",
        },
        {
          name: null,
          id: "peopleApply",
          applyName: "负责人",
          value: "",
          info: "",
        },
        {
          name: null,
          id: "phoneApply",
          applyName: "负责人联系电话",
          value: "",
          info: "请输入负责人联系电话",
        },
        {
          name: null,
          id: "unitApply",
          applyName: "工程名称",
          value: "",
          info: "请输入工程名称",
        },
        {
          name: null,
          id: "eventApply",
          applyName: "申请事由",
          value: "",
          info: "请输入申请事由",
        },
        {
          name: null,
          id: "contentApply",
          applyName: "申请内容",
          value: "",
          info: "请输入申请内容",
        },
      ]),
      checked1: ref(true),
      checked2: ref(false),
      input: ref(""),
      textarea: ref(""),
      num: ref(0),
    });
    this.router = useRouter();
  }
  handleHome = () => {
    console.log(123);
    this.router.push({ path: "/home" });
  };
  handleChange = (value: number) => {
    console.log("value11", value);
  };
  openDialog = () => {
    this.isShowDial.value = true;
  };
}
